package bookExercise;

import java.io.*;
public class A18intoutStream {
    public static void main(String[] args) {
        File f = new File("D:\\aaa.txt");
        try {
            FileOutputStream out = new FileOutputStream(f);
            byte[] a ="我有一头小毛驴".getBytes();
            out.write(a);
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        try{
            FileInputStream in =new FileInputStream(f);
            byte[] b =new byte[1024];
            int len =in.read(b);
            System.out.println("文件中的信息是："+new String(b,0,len));
            in.close();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }
}
